From 35a6bd68317972b7bfccf546de04060e09dbab93 Mon Sep 17 00:00:00 2001
From: wb9688 <wb9688@users.noreply.github.com>
Date: Tue, 2 Mar 2021 14:00:48 +0100
Subject: [PATCH 1/2] Set some settings in GSettings as well

---
 src/lxappearance.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/src/lxappearance.c b/src/lxappearance.c
index f31e794..18ba471 100644
--- a/src/lxappearance.c
+++ b/src/lxappearance.c
@@ -462,6 +462,97 @@ static void lxappearance_save_gtkrc()
     g_free(file_path);
 }
 
+#if GLIB_CHECK_VERSION(2, 40, 0)
+static void lxappearance_save_gsettings()
+{
+    GSettingsSchemaSource *source = g_settings_schema_source_get_default();
+    if (!source)
+        return;
+
+    GSettingsSchema *schema = g_settings_schema_source_lookup(source, "org.gnome.desktop.interface", TRUE);
+    if (!schema)
+        return;
+
+    GSettings *settings = g_settings_new("org.gnome.desktop.interface");
+
+    if (app.widget_theme && g_settings_schema_has_key(schema, "gtk-theme"))
+        g_settings_set_string(settings, "gtk-theme", app.widget_theme);
+
+    if (app.icon_theme && g_settings_schema_has_key(schema, "icon-theme"))
+        g_settings_set_string(settings, "icon-theme", app.icon_theme);
+
+    if (app.default_font && g_settings_schema_has_key(schema, "font-name"))
+        g_settings_set_string(settings, "font-name", app.default_font);
+
+    if (app.cursor_theme && g_settings_schema_has_key(schema, "cursor-theme"))
+        g_settings_set_string(settings, "cursor-theme", app.cursor_theme);
+
+    if (g_settings_schema_has_key(schema, "cursor-size"))
+        g_settings_set_int(settings, "cursor-size", app.cursor_theme_size);
+
+    if (app.font_rgba && g_settings_schema_has_key(schema, "font-antialiasing") && g_settings_schema_has_key(schema, "font-rgba-order"))
+    {
+        if (!app.enable_antialising)
+            g_settings_set_string(settings, "font-antialiasing", "none");
+        else if (strcmp(app.font_rgba, "none") == 0)
+            g_settings_set_string(settings, "font-antialiasing", "grayscale");
+        else
+        {
+            g_settings_set_string(settings, "font-antialiasing", "rgba");
+            if (strcmp(app.font_rgba, "rgb") == 0)
+                g_settings_set_string(settings, "font-rgba-order", "rgb");
+            else if (strcmp(app.font_rgba, "bgr") == 0)
+                g_settings_set_string(settings, "font-rgba-order", "bgr");
+            else if (strcmp(app.font_rgba, "vrgb") == 0)
+                g_settings_set_string(settings, "font-rgba-order", "vrgb");
+            else if (strcmp(app.font_rgba, "vbgr") == 0)
+                g_settings_set_string(settings, "font-rgba-order", "vbgr");
+        }
+    }
+
+    if (app.hinting_style && g_settings_schema_has_key(schema, "font-hinting"))
+    {
+        if (!app.enable_hinting || strcmp(app.hinting_style, "hintnone") == 0)
+            g_settings_set_string(settings, "font-hinting", "none");
+        else if (strcmp(app.hinting_style, "hintslight") == 0)
+            g_settings_set_string(settings, "font-hinting", "slight");
+        else if (strcmp(app.hinting_style, "hintmedium") == 0)
+            g_settings_set_string(settings, "font-hinting", "medium");
+        else if (strcmp(app.hinting_style, "hintfull") == 0)
+            g_settings_set_string(settings, "font-hinting", "full");
+    }
+
+    if (g_settings_schema_has_key(schema, "menus-have-icons"))
+        g_settings_set_boolean(settings, "menus-have-icons", app.menu_images);
+
+    if (g_settings_schema_has_key(schema, "buttons-have-icons"))
+        g_settings_set_boolean(settings, "buttons-have-icons", app.button_images);
+
+    if (g_settings_schema_has_key(schema, "toolbar-style"))
+    {
+        if (app.toolbar_style == 0)
+            g_settings_set_string(settings, "toolbar-style", "icons");
+        else if (app.toolbar_style == 1)
+            g_settings_set_string(settings, "toolbar-style", "text");
+        else if (app.toolbar_style == 2)
+            g_settings_set_string(settings, "toolbar-style", "both");
+        else if (app.toolbar_style == 3)
+            g_settings_set_string(settings, "toolbar-style", "both-horiz");
+    }
+
+    if (g_settings_schema_has_key(schema, "toolbar-icons-size"))
+    {
+        if (app.toolbar_icon_size == 2)
+            g_settings_set_string(settings, "toolbar-icons-size", "small");
+        else if (app.toolbar_icon_size == 3)
+            g_settings_set_string(settings, "toolbar-icons-size", "large");
+    }
+
+    g_settings_schema_unref(schema);
+    g_object_unref(settings);
+}
+#endif
+
 static void lxappearance_save_lxsession()
 {
     char* rel_path = g_strconcat("lxsession/", lxsession_name, "/desktop.conf", NULL);
@@ -532,6 +623,9 @@ static void on_dlg_response(GtkDialog* dlg, int res, gpointer user_data)
         if(app.use_lxsession)
             lxappearance_save_lxsession();
         lxappearance_save_gtkrc();
+#if GLIB_CHECK_VERSION(2, 40, 0)
+        lxappearance_save_gsettings();
+#endif
 
         reload_all_programs();
 

From 703accd389b9dc6e9f5ed4fc3ffc23aacf893bc1 Mon Sep 17 00:00:00 2001
From: wb9688 <wb9688@users.noreply.github.com>
Date: Tue, 16 Mar 2021 19:20:08 +0100
Subject: [PATCH 2/2] Remove toolbar icon size options other than large and
 small

---
 data/ui/lxappearance.glade | 12 ------------
 src/other.c                |  4 ++--
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/data/ui/lxappearance.glade b/data/ui/lxappearance.glade
index 19554cc..892c46d 100644
--- a/data/ui/lxappearance.glade
+++ b/data/ui/lxappearance.glade
@@ -2125,24 +2125,12 @@
       <column type="gchararray"/>
     </columns>
     <data>
-      <row>
-        <col id="0" translatable="yes">Same as menu items</col>
-      </row>
       <row>
         <col id="0" translatable="yes">Small toolbar icon</col>
       </row>
       <row>
         <col id="0" translatable="yes">Large toolbar icon</col>
       </row>
-      <row>
-        <col id="0" translatable="yes">Same as buttons</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Same as drag icons</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Same as dialogs</col>
-      </row>
     </data>
   </object>
   <object class="GtkListStore" id="tb_style_store">
diff --git a/src/other.c b/src/other.c
index d79b28d..aaaeb41 100644
--- a/src/other.c
+++ b/src/other.c
@@ -30,7 +30,7 @@ static void on_tb_style_changed(GtkComboBox* combo, gpointer user_data)
 
 static void on_tb_icon_size_changed(GtkComboBox* combo, gpointer user_data)
 {
-    app.toolbar_icon_size = gtk_combo_box_get_active(combo) + GTK_ICON_SIZE_MENU;
+    app.toolbar_icon_size = gtk_combo_box_get_active(combo) + GTK_ICON_SIZE_SMALL_TOOLBAR;
     lxappearance_changed();
 }
 
@@ -72,7 +72,7 @@ void other_init(GtkBuilder* b)
     g_signal_connect(app.tb_style_combo, "changed", G_CALLBACK(on_tb_style_changed), NULL);
 
     app.tb_icon_size_combo = GTK_WIDGET(gtk_builder_get_object(b, "tb_icon_size"));
-    idx = app.toolbar_icon_size - GTK_ICON_SIZE_MENU;
+    idx = app.toolbar_icon_size - GTK_ICON_SIZE_SMALL_TOOLBAR;
     gtk_combo_box_set_active(GTK_COMBO_BOX(app.tb_icon_size_combo), idx);
     g_signal_connect(app.tb_icon_size_combo, "changed", G_CALLBACK(on_tb_icon_size_changed), NULL);
 
